/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1635215727388_2561';

  // add your middleware config here
  config.middleware = ["errorHandler", "jwt"];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    mysql: {
      // 单数据库信息配置
      client: {
        // host
        host: 'localhost',
        // 端口号
        port: '3306',
        // 用户名
        user: 'root',
        // 密码
        password: 'root',
        // 数据库名
        database: 'crud',
      },
      // 是否加载到 app 上，默认开启
      app: true,
      // 是否加载到 agent 上，默认关闭
      agent: false,
    },
    errorHandler: {
      match: '/api',
    },
    security: {
      csrf: false
    },
    validate: {
      // convert: false,
      // validateRoot: false,
    },
    jwt: {
      white: ["/login", "/captcha", "/upload",'/three']
    },
    multipart: {
      mode: 'file',
      whiteList: ['.jpg', '.png'],
      fileSize: '2mb',
      allowArrayField: true
    },
    gitee: {
      client_id: "9b108c68d132208a8822c8bf9b32c260728fe41d883b88b9090d18774c149088",
      client_secret: "e3289c2c28e1586ff4cb8411c7842f2ba152ad3fa3eff27d42cfb5dcf8f89716",
      redirect_uri: "http://localhost:8080/login"
    }
  };

  return {
    ...config,
    ...userConfig,
  };
};
